package com.seanchenxi.gwt.wordpress.xmlrpc.service.local.impl;

import com.seanchenxi.gwt.wordpress.xmlrpc.service.BloggerServiceAsync;
import com.seanchenxi.gwt.wordpress.xmlrpc.service.impl.BloggerServiceAsyncImpl;

abstract class BloggerLocalServiceAsyncWrapper extends
		LocalServiceWrapper {

	BloggerServiceAsync bloggerService = null;

	/**
	 * Instantiates a new blogger local service async wrapper.
	 * 
	 * @param url
	 *            the xmlrpc's url
	 * @param wpUserName
	 *            the wordpress's user name
	 * @param wpPassword
	 *            the wordpress's password
	 */
	public BloggerLocalServiceAsyncWrapper(String url, String wpUserName,
			String wpPassword) {

		assert (url != null && url.length() > 7);
		assert (wpUserName != null && wpUserName.trim().length() > 0
				&& wpPassword != null && wpPassword.trim().length() > 0);

		bloggerService = new BloggerServiceAsyncImpl(url);

		assert (bloggerService != null);

		setWpUser(wpUserName, wpPassword);
	}

	protected BloggerServiceAsync getBloggerService() {
		return (BloggerServiceAsync) bloggerService;
	}
}
